/*
 * @Author: {易玩脚本圈:486675857}  
 *脚本交流群:1009722787
 * @Date: 2020-04-21 13:16:03 
 * @Last Modified by: 易玩脚本圈
 * @Last Modified time: 2020-05-02 17:15:14
 * */
'ui';
ui.layout(
  <vertical>
    <webview id="a" h="450" w="350" />
  </vertical>
)
var url = "https://www.xiaohongshu.com/user/profile/5a40decde8ac2b156a0bbe91"
var settings = ui.a.getSettings()
settings.setJavaScriptCanOpenWindowsAutomatically(true);
ui.a.loadUrl(url);

webView=ui.a

var js = "javascript:src=document.querySelector('.normal-image > img').alt+document.cookie;"

var setIntervalId;
setIntervalId = setInterval(() => {
  var P = ui.a.getProgress();
  log(P)
  if (P == 10) {
    setTimeout(
      function () {
        ui.a.evaluateJavascript(js, new android.webkit.ValueCallback(
          function onReceiveValue(s) {
           log(s)
           // webView.loadUrl(s.replace(/"/g,''))
          }
        ))
        webView.post(
          new java.lang.Runnable(
            {
              run:function(){
                   webView.loadUrl("javascript:alert(123);")
                // webView.loadUrl("javascript:alert(document.getElementsByTagName('img')[0].src);")
                // webView.loadUrl("javascript:alert(document.querySelector('#logo > a > img').src);")
                // webView.loadUrl("javascript:window.navigate('https://www.qq.com/');")
                // webView.loadUrl("javascript:document.querySelector('#logo > a > img').src;")

                // window.navigate('http://shanghepinpai.com')
                // webView.loadUrl("javascript:document.querySelector('#logo > a > img').src;")
              }
            }
          )
        )
      }, 1000
    )
  }
  clearInterval(setIntervalId)
}, 100);




